import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import './assets/main.css'

// 引入Vant
import { 
  Button, 
  NavBar, 
  Cell, 
  CellGroup, 
  Form, 
  Field, 
  Toast, 
  Dialog, 
  Tabbar, 
  TabbarItem,
  Icon,
  Grid,
  GridItem,
  Popup,
  Switch
} from 'vant'
import 'vant/lib/index.css'

const app = createApp(App)

// 注册Vant组件
const vantComponents = [
  Button, 
  NavBar, 
  Cell, 
  CellGroup, 
  Form, 
  Field, 
  Dialog, 
  Tabbar, 
  TabbarItem,
  Icon,
  Grid,
  GridItem,
  Popup,
  Switch
]

vantComponents.forEach(Component => {
  app.use(Component)
})

// 全局注册Toast方法
app.use(Toast);

app.use(createPinia())
app.use(router)

app.mount('#app')
